package com.app.service.impl;

import com.app.common.AreasTool;
import com.app.common.EducationTool;
import com.app.common.ExperienceTool;
import com.app.common.SalaryTool;
import com.app.mapper.CustomerMapper;
import com.app.mapper.IndustryMapper;
import com.app.mapper.UserMapper;
import com.app.model.*;
import com.app.service.*;
import com.app.util.*;
import com.app.vo.CustomerListVo;
import com.app.vo.CustomerVo;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.sql.Timestamp;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;


/**
 * @Description:行业实现类
 * @Author: N
 * @Date: 2022年11月24日 10点29分
 */
@Service
public class IndustryServiceImpl implements IndustryService {

    @Autowired
    IndustryMapper industryMapper;


    @Override
    public List<IndustryModel> getAll() {
        List<IndustryModel> modelList = industryMapper.selectList(null);
        return modelList;
    }

    @Override
    public IndustryModel getModelByCode(String code) {
        if(StringTool.isEmpty(code))
        {
            return null;
        }
        QueryWrapper<IndustryModel> queryWrapper = new QueryWrapper<>();
        queryWrapper.select().eq("industry_code", code);
        List<IndustryModel> modelList = industryMapper.selectList(queryWrapper);
        if (modelList==null) {
            return null;
        } else {
            return modelList.get(0);
        }
    }

    @Override
    public IndustryModel getModelByName(String name) {
        QueryWrapper<IndustryModel> queryWrapper = new QueryWrapper<>();
        queryWrapper.select().like("industry_name", name);
        List<IndustryModel> modelList = industryMapper.selectList(queryWrapper);
        if (modelList==null||modelList.size()==0) {
            return null;
        } else {
            return modelList.get(0);
        }
    }
}
